# -*- coding:utf-8 -*-
# @author='dapeng'
# @version='1.0.0'

import urllib.request
import urllib.parse
import json


def shorten(lurl):
    url = 'https://api.70api.com/api/urlcn/?apiKey=6d554e1c14101ed557cc0be1a2e3f657&url=%s'%lurl
    f = urllib.request.urlopen(url)
    result = json.loads(f.read().decode('utf-8'))
    res = result.get('data').get('short_url')
    return res

print(shorten('https://s.weibo.com//weibo?q=%23%E5%A4%96%E4%BA%A4%E9%83%A8%E6%89%B9%E7%BE%8E%E6%BB%A5%E7%94%A8%E5%9B%BD%E5%AE%B6%E5%8A%9B%E9%87%8F%E6%89%93%E5%8E%8B%E4%B8%AD%E5%9B%BD%E4%BC%81%E4%B8%9A%23&Refer=top'))